import originAxios from 'axios'
const axios = originAxios.create({
	baseURL: (process.env.NODE_ENV === 'development') ? '/api' : ''
});
/**
 * get 请求使用 params 包裹所有参数
 * post 请求将所有参数之间传入
 */


// 用户登录
export const postUserLogin = params => axios.post('/user/login', { ...params });
// 用户注册
export const postUserRegister = params => axios.post('/user/register', { ...params });
// 获取用户信息
export const getUserInfo = params => axios.get('/user', { params });
// 用户登出
export const getUserLogout = params => axios.get('/user/logout', { params });


// 检查账号是否重复
export const getCheckAccount = params => axios.get('/check/account', { params });
// 检查用户是否以加入群组
export const getCheckJoinedGroup = params => axios.get('/check/group', { params });


// 更新用户用户名
export const getUpdateName = params => axios.get('/update/user/name', { params });
// 更新用户简介
export const getUpdateIntroduction = params => axios.get('/update/user/intro', { params });
// 更新用户性别
export const getUpdateGender = params => axios.get('/update/user/gender', { params });
// 更新用户头像
export const postUpdateAvator = params => axios.post('/update/user/avator', params);
// 更新群组的名称
export const getUpdateGroupName = params => axios.get('/update/group/name', { params });
// 更新群组的简介
export const getUpdateGroupIntroduction = params => axios.get('/update/group/intro', { params });
// 更新群组的头像
export const postUpdateGroupAvator = params => axios.post('/update/group/avator', params);
// 更改群组设置
export const getUpdateGroupSet = params => axios.get('/update/group/set', { params });
// 移交群主
export const getUpdateGroupCreator = params => axios.get('/update/group/creator', { params });
// 设置成员为群组管理员
export const getUpdateGroupAdmin = params => axios.get('/update/group/admin', { params });


// 创建一个群组
export const postGrouptCreate = params => axios.post('/group/create', { ...params });
// 查找用户所加入的群组,及群组的最后一条消息
export const getGroupUserJoin = params => axios.get('/group', { params });
// 发送一条消息
export const postMessageToGroup = params => axios.post('/group/message', { ...params });
// 获取群聊天记录
export const getGroupMessageContent = params => axios.get('/group/content', { params });
// 更新用户查看群组的最后时间,group_id=0是系统消息的查看时间
export const getGroupLastCheckTime = params => axios.get('/group/check', { params });
// 获取群组信息
export const getGroupInfo = params => axios.get('/group/info', { params });
// 获取公开的群组信息
export const getPublicGroupInfo = params => axios.get('/group/public', { params });
// 加入一个群组
export const getJoinGroup = params => axios.get('/group/join', { params });
// 确认加入群组请求
export const getCheckJoinGroup = params => axios.get('/group/join/checked', { params });
// 获取群组用户
export const getGroupMember = params => axios.get('/group/member', { params });
// 获取群组的设置
export const getGroupSet = params => axios.get('/group/set', { params });
// 退出群组
export const getGroupQuit = params => axios.get('/group/quit', { params });
// 解散群组
export const getGroupDismiss = params => axios.get('/group/dismiss', { params });


// 获取系统消息最后一条
export const getLastSysteMessage = params => axios.get('/sysmsg/last', { params });



// 搜索群组
export const getSearchGroup = params => axios.get('/search/group', { params });


